<?php
namespace Home\Controller;
use Think\Controller;
class ProcessController extends Controller {
    public function _initialize()
    {
        //自动加载的类
        new \Org\Autoload();

        $this->member_id = $this->member_info['member_id'];
        //echo $member_id;exit;
    }
    //首页
    public function index($page=1,$sort=''){
        if(session('member_id')){
            $member_id=session('member_id');
            $member_name=session('member_name');
        }
        $data['title']='找加工 找金银网';
        $data['active']='process';
        $this->assign("data", $data);
        $this->display();
    }
    //获取AJAX数据
    public function get_ajax_data(){
        if(session('member_id')==''){
            $data['msg']='没有登录';
        }else{
            $process_id=I('post.process_id');
            $data=array();
            $data['msg']='ok';
            $Model=D("Process");
            $Model->process_id=$process_id;
            $data['info']=$Model->get_ajax_info();
        }
        echo json_encode($data);
    }
    //提交AJAX数据
    public function submit_ajax_data(){
        if(session('member_id')==''){
            $data['msg']='没有登录';
        }else {
            $member_id = I('post.member_id');
            $process_id = I('post.process_id');
            $message_content = I('post.message_content');
            $process_time = time();

            $data = array();
            $post['process_id'] = $process_id;
            $post['member_id'] = $member_id;
            $post['message_content'] = $message_content;
            $post['message_time'] = $process_time;

            //写入加工留言表
            $Model = D("ProcessMessage");
            $Model->post = $post;
            if (!$Model->message_add_post()) {
                $data['msg'] = '写入数据库失败,请您重新提交';
                exit;
            }
            $data['msg']='ok';
//            $data=$member_id;
        }
        echo json_encode($data);
    }
            //print_r($post);exit;
    /*//报价
    public function reg(){
        $data['title']='注册 找金银网';
        $this->assign("data", $data);
        $this->display();
    }
    //登录
    public function login(){
        $data['title']='登录 找金银网';
        $this->assign("data", $data);
        $this->display();
    }
    //会员中心
    public function center(){
        $data['title']='会员中心 找金银网';
        $this->assign("data", $data);
        $this->display();
    }
    //会员中心
    public function dantiao(){
        $data['title']='会员中心 找金银网';
        $this->assign("data", $data);
        $this->display();
    }
    //会员中心
    public function baojiadan(){
        $data['title']='会员中心 找金银网';
        $this->assign("data", $data);
        $this->display();
    }
    //会员中心
    public function wodecaigou(){
        $data['title']='会员中心 找金银网';
        $this->assign("data", $data);
        $this->display();
    }
    //会员中心
    public function wodegonghuo(){
        $data['title']='会员中心 找金银网';
        $this->assign("data", $data);
        $this->display();
    }
    //会员中心
    public function xiugai(){
        $data['title']='会员中心 找金银网';
        $this->assign("data", $data);
        $this->display();
    }
    //会员中心
    public function zengxin(){
        $data['title']='会员中心 找金银网';
        $this->assign("data", $data);
        $this->display();
    }*/
}